#ifndef _LINUX_KFIFO_H
#define _LINUX_KFIFO_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdint.h>

typedef struct kfifo 
{
	uint8_t *buffer;	/* the buffer holding the data */
	uint32_t size;	/* the size of the allocated buffer */
	uint32_t in;	/* data is added at offset (in % size) */
	uint32_t out;	/* data is extracted from off. (out % size) */
}Kfifo;

void kfifo_init(Kfifo *fifo,uint8_t *buffer, uint32_t size);
Kfifo *kfifo_alloc(uint32_t size);
void kfifo_free(Kfifo *fifo);

uint32_t kfifo_put(Kfifo *fifo,uint8_t *buffer, uint32_t len);
uint32_t kfifo_get(Kfifo *fifo,uint8_t *buffer, uint32_t len);
uint32_t kfifo_len(Kfifo *fifo);


uint32_t kfifo_get_all(Kfifo *fifo,uint8_t *buffer);
#endif /* __KERNEL__ */








